<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="keywords" content="编程云">
    <meta name="description" content="编程云">
    <meta name="robots" content="all">
    <meta name="copyright" content="">
    <meta name="author" content="编程云">
    <title>实验云</title>
    <!--<link rel=stylesheet href="css/codemirror.min.css">-->
    <link rel="stylesheet" href="CodeMirror/css/style.css" type="text/css">
    <!--<link href="CodeMirror/addon/hint/show-hint.css" rel="stylesheet">-->
    <link href="CodeMirror/css/bootstrap.min.css" rel="stylesheet">
    <link rel=stylesheet href="css/head.css">
    <link rel="stylesheet" type="text/css" href="CodeMirror/css/mycourse.css">
    <link href="css/code.css" rel="stylesheet" type="text/css"/>
    <link rel="stylesheet" type="text/css" href="css/page.css">
    <link rel="stylesheet" type="text/css" href="css/questionDetail.css">
    <style type="text/css">
        .dragbox{position: absolute;top:52px;bottom:0;right: 0;left: 0;}
        #case1{height: 100%;overflow-y: auto;}
    </style>
</head>
<body style="padding: 0">
    <div class="menu">
        <div class="container con_header" style="">
            <nav class="navbar" role="navigation">
                <div class="container-fluid">
                    <div class="navbar-header">
                        <button type="button" class="navbar-toggle" data-toggle="collapse"
                                data-target="#cloud-navbar-collapse">
                            <span class="sr-only">切换导航</span>
                            <span class="icon-bar"></span>
                            <span class="icon-bar"></span>
                            <span class="icon-bar"></span>
                        </button>
                        <div style="width: 40px; height: 40px;">
                            <a class="navbar-brand" href="index.html">
                                <img src="img/logo.png" style="width: 40px; height: 40px;">
                            </a>
                        </div>
                    </div>
                    <div class="collapse navbar-collapse" id="cloud-navbar-collapse">
                        <ul class="nav navbar-nav">
                            <!--<li class="hov"><a href="#">品牌故事</a></li>-->
                            <li class="hov"><a href="courseLibrary.html">课程库</a></li>
                            <!--<li class="hov"><a href="#">关于我们</a></li>-->
                            <!--<li class="hov"><a href="#">编程介绍</a></li>-->
                            <div class="mobile-show isDisplayMb">
                                <li><a href="personalCenter.html">个人信息</a></li>
                                <li><a href="javascript:;" onclick="logOut()">退出登录</a></li>
                            </div>
                            <li class="dropdown head-box isDisplay" >
                                <a href="#" class="head-pic" data-toggle="dropdown">
                                    <img id="userImg" src="img/head_pic.png">
                                    <span id="userName">编程云</span>
                                </a>
                                <ul class="dropdown-menu">
                                    <li><a href="personalCenter.html">个人信息</a></li>
                                    <li><a href="javascript:;" onclick="logOut()">退出登录</a></li>
                                </ul>
                            </li>
                        </ul>
                    </div>
                </div>
            </nav>
        </div>
    </div>
    <div class="dragbox">
        <div class="result lef" id="a" style="height: 100%">
            <div class="showresult show1" id="case1" style="border: 0;border-right: 1px solid #ccc">
                <div class="courseList">
                    <a href="javascript:;" class="menuList">
                        <span id="courseTit" style="line-height: 30px">问题描述</span>
                        <span class="glyphicon glyphicon-fullscreen" id="butt" onclick="fullScr()" style="float: right;margin-top: 7px;margin-right: 5px"></span>
                    </a>
                </div>
                <div id="answerBox" style="overflow: auto">
                    <div class="question-l shadow pd-15">
                        <p class="question-tit">
                            <img src="img/icon_tag.png" class="recommend-tag" alt="推荐问题"/>
                            <a href="javascript:;" id="ques-title" style="font-size: 16px;">问题标题</a><img class="coin-img" src="img/coin.png"/><span id="bonur">奖励金</span>
                            <span id="ques-status"></span>
                            <a href="javascript:;" class="ques-recommend" style="margin-top: 10px;display: none" onclick="questionRecommend(this)">推荐该问题</a>
                            <a href="javascript:;" class="del-link" style="margin-top: 10px;display: none" onclick="delQuestion(this)">删除问题</a>
                        </p>
                        <p class="ques-info">
                            <span><a href="javascript:;" id="ques-asker">发布者</a></span>
                            <span id="ques-time">发布日期</span>
                            <!--<span>来源于 <a href="#" id="ques-chapter">instanceof 运算符</a></span>-->
                        </p>
                        <p id="ques-desc">问题描述</p>
                        <a href="javascript:;" id="codeView" onclick="codeView(this)">查看代码</a>
                    </div>
                    <div class="answer-box shadow pd-15" id="teacherArea">
                        <p class="all-ques">老师回答</p>
                        <div id="teacherAnswer"></div>
                    </div>
                    <div class="answer-box shadow pd-15" id="acceptArea" style="display: none">
                        <p class="all-ques">已采纳回答</p>
                        <div id="acceptAnswer">

                        </div>
                    </div>
                    <div class="answer-box shadow pd-15">
                        <p class="all-ques">所有回答</p>
                        <div id="recommendList"></div>
                        <div id="answerList">
                            <p class="no-answer">暂无答复 , <a href="#myAnswer">我来回答</a> (..•˘_˘•..)</p>
                        </div>
                        <ul class="pagination">
                        </ul>
                    </div>
                    <div class="my-answer-box shadow pd-15">
                        <p class="all-ques">我的回答</p>
                        <textarea rows="10" name="myAnswer" id="myAnswer" class ="form-control" placeholder="撰写我的回答……"></textarea>
                        <button type="button" class="btn sub-answer" id="submitAnswer" onclick="submitAnswer()">提交回答</button>
                        <span class="attachBox"><input type="checkbox" id="attachCode"/> 是否附加代码</span>
                    </div>
                </div>
                </div>
        </div>
        <iframe width="70%" height="100%"  id="codeFrame" name="codeFrame" style="border:0"></iframe>

    </div>
    <div style="clear: both"></div>
    <script type="text/html" id="reply">
        <% for (var i = 0; i < value.length; i ++) { %>
        <div class="answer">
            <img class="answer-img shadow" src="<%= value[i].photo %>"/>
            <a href="#" class="answer-name"><%= value[i].createByName %></a>
            <% if(value[i].recommended == '1'){ %>
            <span class="recommended">[推荐回答]</span>
            <% } %>
            <% if(isAsker && isSolve == '1'){ %>
            <a href="javascript:;" class="adopt-answer" data-id="<%= value[i].id %>" data-create="<%= value[i].createBy %>" onclick="adoptAnswer(this)">采纳该回答</a>
            <% } %>
            <div class="answer-main">
                <p><%= value[i].reason %></p>
            </div>
            <div class="answer-time">
                <span><%= value[i].createDate %></span>
                <% if(value[i].code){ %>
                <a href="javascript:;" class="codeViewLink" data-code="<%= value[i].code %>" onclick="codeView(this)">查看代码</a>
                <% } %>
                <a href="javascript:;" class="zan" data-flag="0" data-id="<%= value[i].id %>" title="点赞" onclick="answerAgree(this)"><img class="zan-img" src="img/zan.png"><span class="agree-num"><%= value[i].supportNum%></span></a>
                <% if(isTeacher){ %>
                <a href="javascript:;" class="recommend" data-flag="0" data-id="<%= value[i].id %>" title="推荐该回答" onclick="answerRecommend(this)"><img class="zan-img" src="img/recommend.png"><span> 荐 </span></a>
                <% } %>
            </div>
        </div>
        <% } %>
    </script>
    <!--<div id="goBack">-->
        <!--<button class="btn btn-danger back" onclick="submitAnswer()">提交</button>-->
    <!--</div>-->
    <script type="text/javascript" src="https://cdn.bootcss.com/respond.js/1.4.2/respond.min.js"></script>
    <script src="CodeMirror/js/jquery.min.js"></script>
    <script src="CodeMirror/js/bootstrap.min.js"></script>
    <script type="text/javascript" src="js/jquery.page.js"></script>
    <script src="js/artTemplate.js"></script>
    <script src="js/template-native.js"></script>
    <script type="text/javascript" src="layer/layer.js"></script>
    <script type="text/javascript" src="js/HOST.js"></script>
    <script src="js/main.js"></script>
    <!--<script type="text/javascript" src="js/answer.js"></script>-->
    <script type="text/javascript" src="js/questionDetail.js"></script>
    <script type="text/javascript">
        $(function () {
            var questionId = window.location.href.split("=")[1];
            var questionInfo = getQuestionInfo(questionId);
            if(questionInfo){
                $("#codeFrame").attr("src","answerEdit.html?type="+questionInfo.type+"&chapterId="+questionInfo.chapter+"&codeId="+questionInfo.codeId);
                reply(questionId,1,"createDate",true,questionInfo.courseId,questionInfo.createBy);
                if(questionInfo.status == "0"){
                    $("#acceptArea").css('display','block');
                }
                if(questionInfo.code){
                    $("#codeView").attr("data-code",questionInfo.code.replace(/"/g,'&quot;'));
                }
                $("#ques-title").attr("data-courseId",questionInfo.courseId);
            }
        });
        function openAndClose(obj) {
            var tmp = obj;
            if ($(tmp).text()=="展开"){
                $(tmp).parent().prev().children().css({
                    "overflow" :"",
                    "text-overflow" :"",
                    "display" :"",
                    "-webkit-line-clamp" :"",
                    "-webkit-box-orient" :""
                });
                $(tmp).parent().parent().parent().css({
                    "height": ""
                });
                var height = $(tmp).parent().prev().height();
                height = height / 0.8;
                if (height > 100){
                    $(tmp).parent().parent().parent().css({
                        "height": height
                    });
                }else{
                    $(tmp).parent().parent().parent().css({
                        "height": 100
                    });
                }
                $(tmp).text("收起");
            }
            else {
                $(tmp).parent().prev().children().css({
                    "overflow" :"hidden",
                    "text-overflow" :"ellipsis",
                    "display" :"-webkit-box",
                    "-webkit-line-clamp" :"4",
                    "-webkit-box-orient" :"vertical"
                });
                $(tmp).parent().parent().parent().css({
                    "height":"100px"
                });
                $(tmp).text("展开");
            }
        }
        function showCode(obj){
            var tmp = $(obj).prev().text();
            alert(tmp);
        }
        function setPage(questionId,courseId,askerId,pages,current){
            console.log("页面初始化，当前页码"+current);

            $(".pagination").createPage({
                pageCount:pages,
                current:current,
                backFn:function(p){
                    // console.log(p);
//					var classify="0";
                    console.log("页码跳转到："+p);
                    reply(questionId,p,"create_date",true,courseId,askerId);
                    if(pages ==0){
                        $(".pagination").css("display","none");
                    }else{
                        $(".pagination").css("display","block");
                    }
                }
            });
        }
        function Show(){
            $("#a").toggle();
            if($("#a").css("display")=="none"){
                codeFrame.window.changeUp();
                $("#codeFrame").width("100%");
            }else {
                codeFrame.window.changeDown();
                $("#codeFrame").width("70%");
            }

        }
        function fullScr(){
            $("#codeFrame").toggle();
            if($("#codeFrame").css("display")=="none"){
                $("#butt").removeClass("glyphicon-fullscreen");
                $("#butt").addClass("glyphicon-resize-small");
                $("#a").width("100%");
                $("#answerBox").children().removeClass('pd-15');
                $("#ques-title").css('font-size','20px');
                $(".ques-info").eq(0).css('line-height','40px');
            }else {
                $("#butt").addClass("glyphicon-fullscreen");
                $("#butt").removeClass("glyphicon-resize-small");
                $("#a").width("30%");
                $("#answerBox").children().addClass('pd-15');
                $("#ques-title").css('font-size','16px');
                $(".ques-info").eq(0).css('line-height','30px');
            }

        }
    </script>
</body>

</html>